<?php session_start();
/**
* @package		Parents@School.
* @copyright	Copyright (C) 2008 Kristof Beckers. All rights reserved.
* @Version		1.0
* @license		GNU/GPL, see LICENSE.php
**/

include ("../../include/config.php");
require_once ("../../include/db.php");
include ("../../include/header.php");

if(isset($_SESSION['myusername'])){
	if ($_SESSION['admin'] == "$adminid") {
$klas = $_GET['klas'];
	
?><head>
<link rel="stylesheet" href="../../css/template_css.css" type="text/css"/> 
<script type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>
<body>
<div align="center"><img src="<?php echo "../$logo" ; ?>" />
</div>
Selecteer een klas <br />

<form name="form1">
  <select name="menu1" onChange="MM_jumpMenu('parent',this,0)">
<?php 
$sql12 = "SELECT DISTINCT Klas FROM $tbvak ORDER BY Klas";
$result12=mysql_query($sql12);


?>    
<option></option>
<option value="?klas=alles">Iedereen</option>
<?php
//while ($row12 = mysql_fetch_array($result12)) {
	while ($row12 = mysql_fetch_assoc($result12)) {
   $klas12 = $row12['Klas'];
   ?>
<option value="?klas=<?php echo $klas12 ; ?>"><?php echo $klas12 ; ?></option>
<?php } ?>
  </select>
</form>
<form name="form1" method="post" action="users_edit_process.php">
  <div align="center">
    <p>&nbsp;</p>
    <p><a href="users.php"><img src="../../images/users.png" width="128" height="128" border="0"></a></p>
    <p>
<!-- Selectie klas alles -->
<?php 
if ($klas == alles){
$sql= "SELECT * from $tbusers ORDER BY klas ASC";
$result=mysql_query($sql);
?>
    <table border="0" class="moduletable-latest1">
    <tr>
      <td>Gebruikersnaam</td>
      <td>Klas</td>
      <td></td>
      <td>Actie</td>
    </tr>
  </table>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
  </div>
<?php
while ($row = mysql_fetch_array($result)) {
	$userid = $row['ID'];
	$username = $row['username'];
	$klas = $row['klas'];
	
?>
<div align="center">
<table class="moduletable-latest1">
    <tr>
      <td><?php echo $username ; ?></td>
      <td><?php echo $klas ; ?></td>
      <td><a href="users_edit_process.php<?php echo "?id=$userid&username=$username&klas=$klas"; ?>"/>Update </a></td>
      <td><a href="users_password_reset.php<?php echo "?id=$userid&username=$username&klas=$klas"; ?>"/>Reset Wachtwoord </a></td>
      </tr>
  </table>	
  <?php }}
  ?>
  
  <!-- einde selectie alles -->
  <!-- Selectie per klas -->
  <?php
  if ($klas !== "alles"){
  $sql= "SELECT * from $tbusers WHERE klas='$klas'";
$result=mysql_query($sql);
  ?>
    <table border="0" class="moduletable-latest1">
    <tr>
      <td>Gebruikersnaam</td>
      <td>Klas</td>
      <td></td>
      <td>Actie</td>
    </tr>
  </table>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
  </div>
<?php
while ($row = mysql_fetch_array($result)) {
	$userid = $row['ID'];
	$username = $row['username'];
	$klas = $row['klas'];
	
?>
<div align="center">
<table class="moduletable-latest1">
    <tr>
      <td><?php echo $username ; ?></td>
      <td><?php echo $klas ; ?></td>
      <td><a href="users_edit_process.php<?php echo "?id=$userid&username=$username&klas=$klas"; ?>"/>Update </a></td>
      <td><a href="users_password_reset.php<?php echo "?id=$userid&username=$username&klas=$klas"; ?>"/>Reset Wachtwoord </a></td>
      </tr>
  </table>  
	
  <?php }
  ?>
  <!-- Einde selectie per klas -->
  </div>
</form>
	
<?php


}
}}
?>
</body>